package com.itheima;

import com.itheima.config.JDBCConfig;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import javax.sql.DataSource;
import java.sql.SQLException;


public class App {
    public static void main(String[] args) throws SQLException {
        //1. 获取核心容器对象
        ApplicationContext applicationContext = new AnnotationConfigApplicationContext(JDBCConfig.class);
        DataSource ds = (DataSource) applicationContext.getBean("dataSource");
        System.out.println(ds.getConnection());
    }
}